package com.wx.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wx.entity.WechatUserAddress;
import com.wx.mapper.WechatUserAddressMapper;
import com.wx.service.UserAddressService;

@Service
public class UserAddressServiceImpl implements UserAddressService {

	@Autowired
	private WechatUserAddressMapper wechatUserAddressMapper;
	
	@Override
	public List<WechatUserAddress> selectAllByUid(Integer uid) {
		return wechatUserAddressMapper.selectAllByUid(uid);
	}

	@Override
	public int insert(WechatUserAddress record) {
		return wechatUserAddressMapper.insert(record);
	}

	@Override
	public WechatUserAddress selectAddressByUidAndId(Integer id, Integer uid) {
		return wechatUserAddressMapper.selectAddressByUidAndId(id, uid);
	}

	@Override
	public void update(WechatUserAddress record) {
		wechatUserAddressMapper.updateByPrimaryKey(record);
	}

	@Override
	public void updateIsDefault(Integer id, boolean isDefault, Integer uid) {
		wechatUserAddressMapper.updateIsDefault(id, isDefault, uid);
	}

	@Override
	public int deleteByPrimaryKey(Integer id) {
		return wechatUserAddressMapper.deleteByPrimaryKey(id);
	}

	@Override
	public WechatUserAddress selectDefaultAddressByUid(Integer uid) {
		return wechatUserAddressMapper.selectDefaultAddressByUid(uid);
	}

}
